﻿namespace Resonator.Domain.Models
{
	using System;
	using System.Globalization;
	using System.Runtime.Serialization;

	public class ResonatorException : Exception
	{
		public ResonatorException()
		{
		}

		public ResonatorException(string message)
			: base(message)
		{
		}

		public ResonatorException(string messageFormat, params object[] args)
			: this(CreateMessage(messageFormat, args))
		{
		}

		protected ResonatorException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public ResonatorException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public ResonatorException(string messageFormat, Exception innerException, params object[] args)
			: this(CreateMessage(messageFormat, args), innerException)
		{
		}

		protected static string CreateMessage(string format, object[] args)
		{
			return string.Format( CultureInfo.InvariantCulture, format, args ); 
		}
	}
}